package com.haima.domin;

public class Bank {
    private String accountId;// 账户号码

    private String accountHolder;// 账户持有人姓名

    private double balance; // 账户余额

    public Bank() {
    }

    public Bank(String accountId, String accountHolder, double balance) {
        this.accountId = accountId;
        this.accountHolder = accountHolder;
        this.balance = balance;
    }

    public String getAccountId() {
        return accountId;
    }

    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }

    public String getAccountHolder() {
        return accountHolder;
    }

    public void setAccountHolder(String accountHolder) {
        this.accountHolder = accountHolder;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public void deposit(double d) {
        System.out.println("存款:" + d + "元");
        this.balance = balance + d;
        System.out.println("账户余额为:" + this.balance);
    }

    public void withdrawal(double d) {
        if (this.balance - d < 0) {
            System.out.println("余额不足,取款失败");
            return;
        }
        System.out.println("取款" + d + "元");

        this.balance = balance - d;
        System.out.println("账户余额为:" + this.balance);
    }
}
